/*

Miranda IM: the free IM client for Microsoft* Windows*

Copyright 2000-2007 Miranda ICQ/IM project, 
all portions of this codebase are copyrighted to the people 
listed in contributors.txt.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
aLONG with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/

#ifndef _UTF8MAIN_H_INCLUDED_
#define _UTF8MAIN_H_INCLUDED_ 1

#ifdef _UNICODE
#define Utf8ToTChar				Utf8ToWideChar
#define Utf8ToTCharStatic		Utf8ToWideCharStatic
#define TCharToUtf8				WideCharToUtf8
#define TCharToUtf8Static		WideCharToUtf8Static

#else
#define Utf8ToTChar				Utf8ToMultiByte
#define Utf8ToTCharStatic		Utf8ToMultiByteStatic
#define TCharToUtf8				MultiByteToUtf8
#define TCharToUtf8Static		MultiByteToUtf8Static
#endif


// check strings
BOOLEAN IsUSASCII(LPCSTR pBuffer, LPDWORD pcbBuffer);
BOOLEAN IsUnicodeASCII(LPCWSTR pBuffer, DWORD cchSize);
BOOLEAN IsUtf8Valid(LPCSTR utfIn);

// encode ansi->utf8
DWORD	MultiByteToUtf8Length(LPCSTR pszIn);
DWORD	MultiByteToUtf8Static(LPCSTR pszIn, LPSTR utfOut, DWORD cchOut);
LPSTR	MultiByteToUtf8(LPCSTR pszIn, LPDWORD pcchUtf8 = NULL);

// encode unicode->utf8
DWORD	WideCharToUtf8Length(LPCWSTR pwszIn);
DWORD	WideCharToUtf8Static(LPCWSTR pwszIn, LPSTR utfOut, DWORD cchOut);
LPSTR	WideCharToUtf8(LPCWSTR pwszIn, LPDWORD pcchUtf8 = NULL);

// decode utf8->ansi
DWORD	Utf8ToMultiByteStatic(LPCSTR utfIn, LPSTR pszOut, DWORD cchOut);
LPSTR	Utf8ToMultiByte(LPCSTR utfIn, LPDWORD pcchOut = NULL);

// decode utf8->unicode
DWORD	Utf8DecodedLength(LPCSTR utfIn);
DWORD	Utf8ToWideCharStatic(LPCSTR utfIn, LPWSTR pwszOut, DWORD cchOut);
LPWSTR	Utf8ToWideChar(LPCSTR utfIn, LPDWORD pcchOut = NULL);

// dynamic ansi->unicode / unicode->ansi translation
LPSTR	WideCharToMultiByte(LPCWSTR pwszIn);
LPWSTR	MultiByteToWideChar(LPCSTR pszIn);

#endif /* _UTF8MAIN_H_INCLUDED_ */